#include "ViolentSearch.h"

int ViolentSearch(std::string s, std::string p)
{
	for (size_t i = 0; i < s.length() - p.length() + 1;)
	{
		for (size_t j = 0; j < p.length();)
		{
			if (s[i] == p[j])
			{
				i++;
				j++;
				if (j == p.length())
				{
					return i - p.length();
				}
			}
			else
			{
				i = i - j + 1;
				j = 0;
				break;
			}
		}
	}

	return -1;
}
